@extends('admin.layouts.default')
@section('content')
    <div class="card">
        <div class="card-body">
            @include('admin.config._nav')
            <form class="mt-3" action="{{route('admin.config','site')}}" method="post">
                @csrf @method('PUT')
                <div class="form-row">
                    <div class="col-12 col-md-6 mb-3">
                    <label for="exampleInput">网站名称</label>
                    <input type="text" class="form-control " id="exampleInput" name="webname"
                    value="{{get_config('admin.site.webname')}}">
                    </div>
                    <div class="col-12 col-md-6 mb-3">
                    <label for="exampleInputEmail1">客服邮箱</label>
                    <input type="email" class="form-control" value="{{get_config('admin.site.email')}}" id="exampleInputEmail1" name="email">
                    </div>
                </div>
                <div class="form-row">
                <div class="col-12 col-md-6 mb-3">
                    <label for="exampleInputEmail1">网站ICP</label>
                    <input type="text" class="form-control" id="exampleInputEmail1" name="icp"
                    value="{{get_config('admin.site.icp')}}">
                </div>
                <div class="col-12 col-md-6 mb-3">
                    <label for="exampleInputEmail1">客服电话</label>
                    <input type="number" class="form-control" id="exampleInputEmail1" name="tel"
                    value="{{get_config('admin.site.tel')}}">
                </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputEmail1">后台图像</label>
                        <div class="input-group mb-1">
                            <input type="text" class="form-control" id="exampleInputEmail1" readonly name="icon"
                            value="{{get_config('admin.site.icon')}}">
                            <div class="input-group-append">
                                <button onclick="upImagePc(this)" class="btn btn-secondary" type="button">单图上传</button>
                            </div>
                        </div>
                        <div style="display: inline-block;position: relative;">
                            <img src="{{get_config('admin.site.icon',url('/images/del.jpg'))}}" class="img-responsive img-thumbnail" width="150">
                            <em class="close" style="position: absolute;top: 3px;right: 8px;" title="删除这张图片"
                                onclick="removeImg(this)">×</em>
                        </div>
                </div>
            </form>
        </div>
        <div class="card-footer text-muted">
            <button type="submit" class="btn btn-primary ">提交</button>
        </div>
    </div>
@endsection
@push('js')
    <script>
        //上传图片
        function upImagePc() {
            require(['hdjs'], function (hdjs) {
                hdjs.image(function (images) {
                    //上传成功的图片，数组类型
                    $("[name='icon']").val(images[0]);
                    $(".img-thumbnail").attr('src', images[0]);
                })
            });
        }
    </script>
@endpush
